package com.woniuxy.utils;

import com.woniuxy.controller.info.PriorityInfo;
import com.woniuxy.model.Defectpriority;

import java.util.ArrayList;
import java.util.List;
//转换状态
public class ChangeDefectpriority {

    public static PriorityInfo ChangeToInfo(Defectpriority defectpriority){
        PriorityInfo priorityInfo = CopyUtil.copyOne(defectpriority, PriorityInfo.class);
         ChangeState(priorityInfo, defectpriority);
        return priorityInfo;
    }
    private static void ChangeState(PriorityInfo priorityInfo ,Defectpriority defectpriority){
        Integer state = defectpriority.getDefectpriorityState();

        if (state==1){
            priorityInfo.setDefectpriorityNewState("有效");

        }else if(state==0){
            priorityInfo.setDefectpriorityNewState("禁用");
        }

    }
    public static List<PriorityInfo> ChangeToInfo(List<Defectpriority> defectpriority){
        ArrayList<PriorityInfo> priorityInfos = new ArrayList<>();
        for (Defectpriority defectpriority1 : defectpriority) {
            PriorityInfo priorityInfo = ChangeToInfo(defectpriority1);
            priorityInfos.add(priorityInfo);
        }
        return priorityInfos;
    };
}
